// sharing/pages/setting/setting.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
	  var that = this;
	  app.getShareData(function(res){that.setData({cfg: res.data})});
  },
  navigator: function (e){
	  var t = e.currentTarget.dataset.url;
	  if(t == 'wechat_setting'){
		  wx.openSetting();
	  }else if(t == 'wechat_clear'){
		  wx.showLoading({title: '正在清理...'});
		  wx.clearStorageSync();
		  wx.hideLoading();
			wx.showToast({
			  title: '清理完成',
			  icon: 'success',
			  duration: 1500
			});
	  }else{
		  wx.navigateTo({url: t});
	  }
  },
  onShareAppMessage: function () {
	  return {
	      title: this.data.cfg.indexShare,
	      path: '/sharing/pages/index/index',
	      success: function(res) {
	        // 转发成功
	      },
	      fail: function(res) {
	        // 转发失败
	      }
	    }
  }
})